<?php 
namespace Common\Taglib;
class article{
	 public function run($attr){
		$sort=$attr['sort']?trim($attr['sort']):'new';
		$uid=intval($attr['uid']);
		$category1=intval($attr['category1']);
		$category2=intval($attr['category2']);
		$field=trim($attr['field']);
		$tagid=intval($attr['tagid']);
//		$key=trim($attr['key']);
		$key=I('request.key');
		if ($uid>0){
			$map['uid']=$uid;
		}
		if ($category1>0){
			$map['category1']=$category1;
		}
		if ($category2>0){
			$map['category2']=$category2;
		}
		if ($tagid>0){
			$map['tagid']=$tagid;
		}
		if($sort=='new')
		{
		$order='id DESC';
		}
		if($sort=='hot')
		{
		$order='click DESC';
		}
		if($sort=='exc')//精华
		{
		$map['excellent']=1;
		$order='id DESC';
		}
		if (!empty($key))
		{
		$map['title']= array('LIKE','%'.$key.'%');
		$order='';
		}
		$num=empty($attr['num'])?15:intval($attr['num']);
		$page=intval($attr['page']);
		$result=D('Article')->get_list($map,$page,$order,$num,true);
		return $result;
	 }
	 
	 
}
?>